﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WebDomain.Entities;

namespace WebDomain.Concrete
{
    public class EFTicketRepository
    {
        private CZTopComputersEntities context = new CZTopComputersEntities();

        public IQueryable<Entities.Ticket> Tickets
        {
            get { return context.Tickets; }
        }

        public void RemoveTicket(Ticket ticket)
        {
            context.Tickets.DeleteObject(ticket);
            context.SaveChanges();
        }

        public int GetTicket()
        {
            return Tickets.Max(x => x.ID);
        }

        public void SaveTicket(Ticket ticket)
        {
            context.Tickets.AddObject(ticket);
            context.SaveChanges();
        }
    }
}
